//package com.jsy.common.util.publicApi.aksk;
//
//import com.alibaba.fastjson.JSON;
//import com.cwn.wizbank.comm.bean.LoginUserInfo;
//import com.cwn.wizbank.common.Result;
//import com.cwn.wizbank.entity.TrainingDataParamsDTO;
//import com.cwn.wizbank.entity.vo.TrainingDataCountryVo;
//import com.cwn.wizbank.entity.vo.TrainingDataCourseExamSummaryVo;
//import com.cwn.wizbank.entity.vo.TrainingDataCourseExamVo;
//import com.cwn.wizbank.entity.vo.TrainingDataMaterialVo;
//import com.cwn.wizbank.entity.vo.TrainingDataPersonnelVo;
//import com.cwn.wizbank.security.annotation.Anonymous;
//import com.cwn.wizbank.services.TrainingDataService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestHeader;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * 培训数据回传Controller
// * 处理各类培训数据的请求
// */
//@RestController
//@RequestMapping("/api/training/data")
//public class TrainingDataController {
//
//    @Autowired
//    private TrainingDataService trainingDataService;
//
//    /**
//     * 回传国家培训数据
//     */
//    @RequestMapping(value = "/country",method = RequestMethod.POST)
//    @ResponseBody
//    @Anonymous
//    public Result getCountryData(@RequestHeader Map<String, String> headers,
//                                 @RequestParam Map<String, String> queryParams,
//                                 @RequestBody String requestBody, LoginUserInfo profile) {
//        List<TrainingDataCountryVo> trainingDataCountry = null;
//        try {
//            if (profile == null  && !AkSkAuthenticator.verifyRequest("POST", "/app/api/training/data/country", queryParams, requestBody, headers)) {
//                throw new RuntimeException("Invalid signature");
//            }
//            TrainingDataParamsDTO paramsDTO = JSON.parseObject(requestBody, TrainingDataParamsDTO.class);
//            trainingDataCountry = trainingDataService.getTrainingDataCountry(paramsDTO);
//        } catch (Exception e) {
//           return Result.failure(e.getMessage());
//        }
//
//        return Result.success(trainingDataCountry);
//    }
//
//    /**
//     * 回传培训课程考试数据
//     */
//    @RequestMapping(value = "/course/exam",method = RequestMethod.POST)
//    @ResponseBody
//    @Anonymous
//    public Result getCourseExamData(@RequestHeader Map<String, String> headers,
//                                    @RequestParam Map<String, String> queryParams,
//                                    @RequestBody String requestBody, LoginUserInfo profile) {
//        List<TrainingDataCourseExamVo> courseExam = null;
//        try {
//            if (profile == null && !AkSkAuthenticator.verifyRequest("POST", "/app/api/training/data/course/exam", queryParams, requestBody, headers)) {
//                throw new RuntimeException("Invalid signature");
//            }
//            TrainingDataParamsDTO paramsDTO = JSON.parseObject(requestBody, TrainingDataParamsDTO.class);
//            courseExam = trainingDataService.getTrainingDataCourseExam(paramsDTO);
//        } catch (Exception e) {
//            return Result.failure(e.getMessage());
//        }
//        return Result.success(courseExam);
//    }
//
//    /**
//     * 回传培训课程考试数据总览
//     */
//    @RequestMapping(value = "/course/exam/summary",method = RequestMethod.POST)
//    @ResponseBody
//    @Anonymous
//    public Result getCourseExamSummaryData(@RequestHeader Map<String, String> headers,
//                                           @RequestParam Map<String, String> queryParams,
//                                           @RequestBody String requestBody, LoginUserInfo profile) {
//        List<TrainingDataCourseExamSummaryVo> courseExamSummary = null;
//        try {
//            if (profile == null && !AkSkAuthenticator.verifyRequest("POST", "/app/api/training/data/course/exam/summary", queryParams, requestBody, headers)) {
//                throw new RuntimeException("Invalid signature");
//            }
//            TrainingDataParamsDTO paramsDTO = JSON.parseObject(requestBody, TrainingDataParamsDTO.class);
//            courseExamSummary = trainingDataService.getTrainingDataCourseExamSummary(paramsDTO);
//        } catch (Exception e) {
//            return Result.failure(e.getMessage());
//        }
//        return Result.success(courseExamSummary);
//    }
//
//    /**
//     * 回传人员培训数据
//     */
//    @RequestMapping(value = "/personnel",method = RequestMethod.POST)
//    @ResponseBody
//    @Anonymous
//    public Result getPersonnelData(@RequestHeader Map<String, String> headers,
//                                   @RequestParam Map<String, String> queryParams,
//                                   @RequestBody String requestBody, LoginUserInfo profile) {
//        List<TrainingDataPersonnelVo> personnel = null;
//        try {
//            if (profile == null && !AkSkAuthenticator.verifyRequest("POST", "/app/api/training/data/personnel", queryParams, requestBody, headers)) {
//                throw new RuntimeException("Invalid signature");
//            }
//            TrainingDataParamsDTO paramsDTO = JSON.parseObject(requestBody, TrainingDataParamsDTO.class);
//            personnel = trainingDataService.getTrainingDataPersonnel(paramsDTO);
//        } catch (Exception e) {
//            return Result.failure(e.getMessage());
//        }
//        return Result.success(personnel);
//    }
//
//
//    /**
//     * 回传培训资料数据
//     */
//    @RequestMapping(value = "/material",method = RequestMethod.POST)
//    @ResponseBody
//    @Anonymous
//    public Result getMaterialData(@RequestHeader Map<String, String> headers,
//                                  @RequestParam Map<String, String> queryParams,
//                                  @RequestBody String requestBody, LoginUserInfo profile) {
//        List<TrainingDataMaterialVo> material = null;
//        try {
//            if (profile == null && !AkSkAuthenticator.verifyRequest("POST", "/app/api/training/data/material", queryParams, requestBody, headers)) {
//                throw new RuntimeException("Invalid signature");
//            }
//            TrainingDataParamsDTO paramsDTO = JSON.parseObject(requestBody, TrainingDataParamsDTO.class);
//            material = trainingDataService.getTrainingDataMaterial(paramsDTO);
//        } catch (Exception e) {
//            return Result.failure(e.getMessage());
//        }
//        return Result.success(material);
//    }
//
//
//    /**
//     * 批量回传培训数据
//     */
//    @RequestMapping(value = "/getBatchData",method = RequestMethod.POST)
//    @ResponseBody
//    @Anonymous
//    public Result getBatchData(@RequestHeader Map<String, String> headers,
//                               @RequestParam Map<String, String> queryParams,
//                               @RequestBody String requestBody, LoginUserInfo profile) {
//        HashMap<String, Object> allTrainingData = null;
//        try {
//            if (profile == null && !AkSkAuthenticator.verifyRequest("POST", "/app/api/training/data/getBatchData", queryParams, requestBody, headers)) {
//                throw new RuntimeException("Invalid signature");
//            }
//            TrainingDataParamsDTO paramsDTO = JSON.parseObject(requestBody, TrainingDataParamsDTO.class);
//            allTrainingData = trainingDataService.getAllTrainingData(paramsDTO);
//        } catch (Exception e) {
//           return Result.failure(e.getMessage());
//        }
//        return Result.success(allTrainingData);
//    }
//
//
//}